﻿//********************************************************************************//
//创建日期：<创建日期，2017-7-10>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：来函Model
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    /// <summary>
    /// 发票库存
    /// </summary>
    public class LHLaiHanXX : BaseModel
    {
        public LHLaiHanXX()
        {

        }


        public int ID { get; set; }
        public string S_BEIZHU { get; set; }
        public string S_LAIHANBH { get; set; }

        public string S_XUKEBH { get; set; }

        public string S_TONGYIBM { get; set; }

        public int I_LAIHANLX { get; set; }

        public string S_LAIHANLX { get; set; }
        public string S_YONGHUBH { get; set; }
        public string S_YONGHUM { get; set; }
        ///// <summary>
        ///// 许可受理号
        ///// </summary>
        //public string S_BEIYONG1 { get; set; }
        public DbInt I_Y { get; set; }
        public DbInt I_M { get; set; }
        public DbInt I_TZY { get; set; }
        public DbInt I_TZM { get; set; }
        public string S_YM { get; set; }
        public string S_YWY { get; set; }
        public DbDateTime D_LAIHANRQ { get; set; }
        public DbDateTime D_SHURURQ { get; set; }
        public DbDateTime D_SHENPIRQ { get; set; }
        public DbInt I_SHENPIR { get; set; }
        public DbInt I_DENGJIR { get; set; }
        public DbInt I_SHENPIJG { get; set; }
        public string S_SHENPIJG{ get; set; }
        public string S_SHENPIR { get; set; }
        public int I_LIUCHENGZT { get; set; }
        public string S_LIUCHENGZT { get; set; }

        public string S_DENGJIR { get; set; }
        public string S_FUSHENR { get; set; }

        public string S_FUSHEN { get; set; }
        public int Days { get; set; }
        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.ID = row.Table.Columns.Contains("ID")?Convert.ToInt32(row["ID"]):-1;
            this.I_LAIHANLX = row.Table.Columns.Contains("I_LAIHANLX") ? Convert.ToInt32(row["I_LAIHANLX"]) : -1;
            this.I_LIUCHENGZT = row.Table.Columns.Contains("I_LIUCHENGZT") ? Convert.ToInt32(row["I_LIUCHENGZT"]) : -1;
            this.I_M = row.Table.Columns.Contains("I_M") ? DbInt.Parse(row["I_M"]) : DbInt.Parse(null);
            this.I_SHENPIJG = row.Table.Columns.Contains("I_SHENPIJG") ? DbInt.Parse(row["I_SHENPIJG"]) : DbInt.Parse(null);
            this.I_Y = row.Table.Columns.Contains("I_Y") ? DbInt.Parse(row["I_Y"]) : DbInt.Parse(null);
            this.I_SHENPIR = row.Table.Columns.Contains("I_SHENPIR") ? DbInt.Parse(row["I_SHENPIR"]) : DbInt.Parse(null);
            this.I_DENGJIR = row.Table.Columns.Contains("I_DENGJIR") ? DbInt.Parse(row["I_DENGJIR"]) : DbInt.Parse(null);
            this.I_TZY = row.Table.Columns.Contains("I_TZY") ? DbInt.Parse(row["I_TZY"]) : DbInt.Parse(null);
            this.I_TZM = row.Table.Columns.Contains("I_TZM") ? DbInt.Parse(row["I_TZM"]) : DbInt.Parse(null);
            this.Days = row.Table.Columns.Contains("Days") ? Convert.ToInt32(row["Days"]) : 0;


            //this.S_BEIYONG1 = row.Table.Columns.Contains("S_BEIYONG1") ? Convert.ToString(row["S_BEIYONG1"]) : null;
            this.S_BEIZHU = row.Table.Columns.Contains("S_BEIZHU") ? Convert.ToString(row["S_BEIZHU"]) : null;
            this.S_LAIHANBH = row.Table.Columns.Contains("S_LAIHANBH") ? Convert.ToString(row["S_LAIHANBH"]) : null;
            this.S_LAIHANLX = row.Table.Columns.Contains("S_LAIHANLX") ? Convert.ToString(row["S_LAIHANLX"]) : null;
            this.S_LIUCHENGZT = row.Table.Columns.Contains("S_LIUCHENGZT") ? Convert.ToString(row["S_LIUCHENGZT"]) : null;
            this.S_SHENPIJG = row.Table.Columns.Contains("S_SHENPIJG") ? Convert.ToString(row["S_SHENPIJG"]) : null;
            this.S_TONGYIBM = row.Table.Columns.Contains("S_TONGYIBM") ? Convert.ToString(row["S_TONGYIBM"]) : null;
            this.S_XUKEBH = row.Table.Columns.Contains("S_XUKEBH") ? Convert.ToString(row["S_XUKEBH"]) : null;
            this.S_YM = row.Table.Columns.Contains("S_YM") ? Convert.ToString(row["S_YM"]) : null;
            this.S_YONGHUBH = row.Table.Columns.Contains("S_YONGHUBH") ? Convert.ToString(row["S_YONGHUBH"]) : null;
            this.S_YONGHUM = row.Table.Columns.Contains("S_YONGHUM") ? Convert.ToString(row["S_YONGHUM"]) : null;
            this.S_YWY = row.Table.Columns.Contains("S_YWY") ? Convert.ToString(row["S_YWY"]) : null;
            this.S_DENGJIR = row.Table.Columns.Contains("S_DENGJIR") ? Convert.ToString(row["S_DENGJIR"]) : null;
            this.S_SHENPIR = row.Table.Columns.Contains("S_SHENPIR") ? Convert.ToString(row["S_SHENPIR"]) : null;
            this.S_FUSHENR = row.Table.Columns.Contains("S_FUSHENR") ? Convert.ToString(row["S_FUSHENR"]) : null;
            this.S_FUSHEN = row.Table.Columns.Contains("S_FUSHEN") ? Convert.ToString(row["S_FUSHEN"]) : null;

            this.D_LAIHANRQ = row.Table.Columns.Contains("D_LAIHANRQ") ? DbDateTime.Parse(row["D_LAIHANRQ"]) : DbDateTime.Parse(null);
            this.D_SHENPIRQ = row.Table.Columns.Contains("D_SHENPIRQ") ? DbDateTime.Parse(row["D_SHENPIRQ"]) : DbDateTime.Parse(null);
            this.D_SHURURQ = row.Table.Columns.Contains("D_SHURURQ") ? DbDateTime.Parse(row["D_SHURURQ"]) : DbDateTime.Parse(null);
            
            return this;
        }
    }
    public class DALLHLaiHanXX : BaseDAL
    {
        public DALLHLaiHanXX()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {

        }

        /// <summary>
        /// 来函登记管理查询
        /// </summary>
        public List<LHLaiHanXX> DJCX(int wtype,string glk,string y,string lhbh,string yhh,string xkslh,string lhlx,string zd)
        {
            dbProc.Init("P_YS_LH_LAIHANDJCX");
            dbProc.AddParameter("V_WTYPE", wtype);
            dbProc.AddParameter("V_GUANLIK", glk);
            dbProc.AddParameter("V_Y", y);
            dbProc.AddParameter("V_LAIHANBH", lhbh);
            dbProc.AddParameter("V_YONGHUH", yhh);
            dbProc.AddParameter("V_XUKEH", xkslh);
            dbProc.AddParameter("V_LEIXING", lhlx);
            dbProc.AddParameter("V_ZHANDIAN", zd);
            return CommonService.Ini().GetList<LHLaiHanXX>(dbProc);
        }

        /// <summary>
        /// 获取复审修改列表
        /// </summary>
        public List<LHLaiHanXX> FUSHENXGLIST(string zd,string glk, string lhbh,string yhh,string y,string m,int fs)
        {
            dbProc.Init("P_YSLH_FUSHENXGLIST");
            dbProc.AddParameter("V_GUANLIK", glk);
            dbProc.AddParameter("V_Y", y);
            dbProc.AddParameter("V_M", m);
            dbProc.AddParameter("V_LAIHANBH", lhbh);
            dbProc.AddParameter("V_YONGHUH", yhh);
            dbProc.AddParameter("V_XUKEH", null);
            dbProc.AddParameter("V_ZHANDIAN", zd);//
            dbProc.AddParameter("V_FUSHEN", fs);
            return CommonService.Ini().GetList<LHLaiHanXX>(dbProc);
        }
    }

}